/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86186
 * Date: 2023-06-23
 * Time: 23:04
 */

class Solution {
    public boolean canJump(int[] nums) {
        int n = nums.length;
        int rightmost = 0;
        for(int i = 0; i < n; i++) {
            if(i <= rightmost) {
                rightmost = Math.max(rightmost,i + nums[i]);
                if(rightmost >= n-1) {
                    return true;
                }
            }
        }
        return false;
    }
}
public class Main {
    public static void main(String[] args) {
        System.out.println("Hello world!");
    }
}